package icu.xblogs.report.service.impl;

import icu.xblogs.report.domain.Employee;
import icu.xblogs.report.mapper.EmployeeMapper;
import icu.xblogs.report.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Frank KONG
 * @version 1.0
 * @date 2020/11/17 10:07
 */
@Service("employeeService")
public class EmployeeServiceImpl implements EmployeeService {

    private EmployeeMapper employeeMapper;

    @Autowired
    public void setEmployeeMapper(EmployeeMapper employeeMapper) {
        this.employeeMapper = employeeMapper;
    }

    @Override
    public Employee getByIdAndPsw(int id, String password) {
        return employeeMapper.getByIdAndPsw(id, password);
    }

    @Override
    public Employee getById(int id) {
        return employeeMapper.getById(id);
    }

    @Override
    public void updatePsw(int id, String oldPassword, String newPassword) {
        employeeMapper.updatePsw(id, oldPassword, newPassword);
    }

    @Override
    public String getImg(int id) {
        return employeeMapper.getImg(id);
    }

    @Override
    public String updateImg(String img, int id) {
        employeeMapper.updateImg(img, id);
        return employeeMapper.getImg(id);
    }
}
